package com.glsc.ngateway.common.base.domain.mysql.opmanagemain.task;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.DateSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * @author liwei
 * 运管代办任务
 */
@Data
@Entity
@Table(name = "t_task_info")
@org.hibernate.annotations.Table(appliesTo = "t_task_info", comment = "运管代办任务")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class TaskInfo implements Serializable {
    private static final long serialVersionUID = -5314295745666872481L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Integer id;

    @Column(name = "business_id", columnDefinition = "varchar(100) COMMENT '业务id'")
    @ApiModelProperty(value = "业务id")
    private String businessId;

    @Column(name = "name", columnDefinition = "varchar(200) COMMENT '任务名称'")
    @ApiModelProperty(value = "任务名称")
    private String name;

    @Column(name = "type", columnDefinition = "varchar(40) COMMENT '任务类型,数据字典t_opmanage_task_type'")
    @ApiModelProperty(value = "任务类型")
    private String type;

    @Column(name = "status", columnDefinition = "varchar(20) COMMENT '任务状态,0代办,1已办'")
    @ApiModelProperty(value = "任务状态")
    private String status;

    @Column(name = "role_code", columnDefinition = "varchar(40) COMMENT '角色编码'")
    @ApiModelProperty(value = "角色编码")
    private String roleCode;

    @Column(name = " user_name", columnDefinition = "varchar(200) COMMENT '指定处理用户名称'")
    @ApiModelProperty(value = "指定处理用户名称")
    private String userName;

    @Column(name = "user_id", columnDefinition = "int DEFAULT NULL COMMENT '指定处理用户id'")
    @ApiModelProperty(value = "指定处理用户id")
    private Long userId;

    @Column(name = "shot_url", columnDefinition = "varchar(100) COMMENT '短链接-前端跳转页面使用'")
    @ApiModelProperty(value = "短链接-前端跳转页面使用")
    private String shotUrl;

    //创建时间
    @Column(name = "create_time", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @Column(name = "finish_time", updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = DateSerializer.class)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "完成时间")
    private Date finishTime;


}
